package com.hbnu.service.impl;

import com.hbnu.anno.Log;
import com.hbnu.domain.Book;
import com.hbnu.mapper.BookMapper;
import com.hbnu.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @version: 1.0
 * @ClassName: BookServiceImpl
 * @Description: TODO
 * @Author: 86132
 * @Date: 2025/11/12 13:43
 */
@Service("bookService")
public class BookServiceImpl implements BookService {
    @Autowired
    private BookMapper bookMapper;

    //预约民宿
    @Override
    @Log
    public void book(Book book) {
        bookMapper.insert(book);
    }

    //查看用户预约
    @Log
    @Override
    public List<Book> listByUserId(Integer userId) {
        return bookMapper.listByUserId(userId);
    }

    @Log
    @Override
    public void deleteById(Integer id) {
        bookMapper.deleteById(id);
    }

    //根据id查询预约
    @Log
    @Override
    public Book searchById(Integer id) {
        return bookMapper.searchById(id);
    }
}
